home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BMUG PD-ROM B4
/
PD-ROM B4.iso
/
Entertainment
/
Strategy
/
Robots
/
bot 1.0.1
/
Tutorial
/
ASM
/
Seeker
< prev
next >
Wrap
Text File
|
1991-07-19
|
921b
|
34 lines
!
! Seeker
!
! This bot scans around in a circle until it finds another bot.
! It locks on to the bot, firing until the enemy bot leaves the
! arc of the scanner. Then it resumes scanning.
#DATA
DEF SCAN_AT ! Current scan angle
EQU INCREMENT 11 ! Amount to add to scan angle each time
#CODE ASM
:INITIALIZE
RND 360, SCAN_AT ! Start at a random angle
:SCANLOOP
ADD INCREMENT, SCAN_AT
SCN SCAN_AT
CMP S0, 0 ! S0 == 0 means that nothing was found
BEQ SCANLOOP ! ... so continue around in a circle
! ... otherwise, go on to SCANLOCK
:SCANLOCK
MOV S1, R1 ! Tell the weapon what angle to fire at
FIR 1 ! Fire weapon
SCN SCAN_AT ! Check to see if enemy is still there
CMP S0, 0
BEQ SCANLOOP ! If not, resume scanning
JMP SCANLOCK ! If so, keep firing until he dies or
! moves.
#END